const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import('@/views/Home.vue'),
    meta: { title: '首页' }
  },
  {
    path: '/user',
    children: [
      {
        path: 'login',
        name: 'Login',
        component: () => import('@/views/user/Login.vue'),
        meta: { title: '登录' }
      },
      {
        path: 'profile',
        name: 'Profile',
        component: () => import('@/views/user/Profile.vue'),
        meta: { title: '个人资料', requiresAuth: true }
      },
      {
        path: 'settings',
        name: 'Settings',
        component: () => import('@/views/user/Settings.vue'),
        meta: { title: '设置', requiresAuth: true }
      },
      {
        path: 'change-password',
        name: 'ChangePassword',
        component: () => import('@/views/user/ChangePassword.vue'),
        meta: { title: '修改密码', requiresAuth: true }
      },
      {
        path: 'my-comments',
        name: 'MyComments',
        component: () => import('@/views/user/MyComments.vue'),
        meta: { title: '我的评论', requiresAuth: true }
      },
      {
        path: 'my-posts',
        name: 'MyPosts',
        component: () => import('@/views/user/MyPosts.vue'),
        meta: { title: '我的发帖', requiresAuth: true }
      }
    ]
  },
  {
    path: '/collection',
    children: [
      {
        path: '',
        name: 'CollectionIndex',
        component: () => import('@/views/collection/Index.vue'),
        meta: { title: '藏品广场' }
      },
      {
        path: 'detail/:id',
        name: 'CollectionDetail',
        component: () => import('@/views/collection/Detail.vue'),
        meta: { title: '藏品详情' }
      },
      {
        path: 'create',
        name: 'CollectionCreate',
        component: () => import('@/views/collection/Create.vue'),
        meta: { title: '创建藏品', requiresAuth: true }
      },
      {
        path: 'category/:id',
        name: 'CollectionCategory',
        component: () => import('@/views/collection/Category.vue'),
        meta: { title: '藏品分类' }
      }
    ]
  },
  {
    path: '/forum',
    children: [
      {
        path: '',
        name: 'ForumIndex',
        component: () => import('@/views/forum/Index.vue'),
        meta: { title: '论坛首页' }
      },
      {
        path: 'post/:id',
        name: 'PostDetail',
        component: () => import('@/views/forum/PostDetail.vue'),
        meta: { title: '帖子详情' }
      },
      {
        path: 'create',
        name: 'CreatePost',
        component: () => import('@/views/forum/CreatePost.vue'),
        meta: { title: '发帖', requiresAuth: true }
      },
      {
        path: 'category/:id',
        name: 'ForumCategory',
        component: () => import('@/views/forum/Category.vue'),
        meta: { title: '论坛分类' }
      }
    ]
  },
  {
    path: '/ranking',
    children: [
      {
        path: '',
        name: 'Ranking',
        component: () => import('@/views/ranking/Index.vue'),
        meta: { title: '排行榜' }
      },
      {
        path: 'detail/:category/:id',
        name: 'RankingDetail',
        component: () => import('@/views/ranking/Detail.vue'),
        meta: { title: '排行榜详情' }
      },
      {
        path: 'add',
        name: 'RankingAdd',
        component: () => import('@/views/ranking/AddPerson.vue'),
        meta: { title: '添加人物', requiresAuth: true }
      }
    ]
  },
  {
    path: '/activity',
    children: [
      {
        path: ':id',
        name: 'ActivityDetail',
        component: () => import('@/views/activity/Detail.vue'),
        meta: { title: '活动详情' }
      }
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import('@/views/error/404.vue'),
    meta: { title: '页面不存在' }
  }
]

export default routes